{%include file="header.html"%}
<style>
table{text-align: center;}
th{text-align:center; font-weight: bolder;}
th a{ color:#000000;}
.firtd {	width: 100px;	padding-right: 10px;	text-align: right;}
input {	width: 350px;}
textarea {	width: 350px;	height: 100px;}
</style>
<body>
<div class="fixed-bar">
<div class="item-title">
    <h3>会员等级列表</h3>
   <form>
    <div style="background:rgba(251,112,45,1);width:125px;height:40px;float:right;text-align:center;border-radius:5px;">
      <a href="user_rank.php?act=edit">
        <h5 style="padding:10px;color:#fff;">添加会员等级</h5>
      </a>
    </div>
    </form>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="" id="aspnetForm" name="form1">
    <table align="center;" class="table tb-type2">
      <thead>
        <tr>
          <th><a>会员等级名称</a></th>
          <th><a>积分下限</a></th>
          <th><a>积分上限</a></th>
          <th><a>初始折扣率(%)</a></th>
          <th><a>会员等级</a></th>
          <th><a>显示价格</a></th>
          <th><a>特殊会员组</a></th>
          <th><a>操作</a></th>
        </tr>
      </thead>
      <tbody id="sortable">
        {%foreach from=$user item=list key=k%}
            <tr id="{%$list.rank_id%}">
              <td>{%$list.rank_name%}</td>
              <td>{%$list.min_points%}</td>
              <td>{%$list.max_points%}</td>
              <td>{%$list.discount%}</td>
              <td>{%$list.rank_num%}</td>
              <td><i style="cursor:pointer;" onclick="get_show_price(this,{%$list.rank_id%},{%$list.show_price%})" class="fa {%if $list.show_price==1%}fa-check{%else%}fa-close{%/if%}"></i></td>
              <td><i style="cursor:pointer;" onclick="get_special_rank(this,{%$list.rank_id%},{%$list.special_rank%})" class="fa {%if $list.special_rank==1%}fa-check{%else%}fa-close{%/if%}"></i></td>
              <td>
                <a href="user_rank.php?act=edit&rank_id={%$list.rank_id%}">编辑</a>
                <a href="javascript:;" onclick="get_rank(this,{%$list.rank_id%})">删除</a>
    
              </td>
            </tr>
        {%/foreach%}
      </tbody>
    </table>
   <div class="page">{%$page%}</div>
  </form>
</div>
</body>
<script>
	function get_rank(obj,id){
        $.post("user_rank.php",{act:'del',rank_id:id},function(data){
            if(data==0){
                layer.alert("该等级下有会员，不可删除！");
                return false;
            }else if(data==1){
                layer.msg("操作成功! ");
                $('#'+id).remove();
            }else if(data==2){
                layer.msg("操作失败！");
            }
        }) 
    }
</script>
</html>